

<!DOCTYPE html>
<html class="writer-html5" lang="en" data-content_root="./">
<head>
  <meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" />

  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>Q &amp; A &mdash; CherryUSB 1.4.2 documentation</title>
      <link rel="stylesheet" type="text/css" href="_static/pygments.css?v=80d5e7a1" />
      <link rel="stylesheet" type="text/css" href="_static/css/theme.css?v=e59714d7" />

  
      <script src="_static/jquery.js?v=5d32c60e"></script>
      <script src="_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
      <script src="_static/documentation_options.js?v=02f2166e"></script>
      <script src="_static/doctools.js?v=9a2dae69"></script>
      <script src="_static/sphinx_highlight.js?v=dc90522c"></script>
    <script src="_static/js/theme.js"></script>
    <link rel="index" title="Index" href="genindex.html" />
    <link rel="search" title="Search" href="search.html" />
    <link rel="next" title="官方开源项目分享" href="opensource.html" />
    <link rel="prev" title="基于 ESP-Registry 开发指南" href="quick_start/esp.html" /> 
</head>

<body class="wy-body-for-nav"> 
  <div class="wy-grid-for-nav">
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search" >

          
          
          <a href="index.html" class="icon icon-home">
            CherryUSB
          </a>
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>
        </div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
              <p class="caption" role="heading"><span class="caption-text">快速上手</span></p>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="quick_start/start.html">入门必看</a></li>
<li class="toctree-l1"><a class="reference internal" href="quick_start/demo.html">基于现有 demo 快速验证</a></li>
<li class="toctree-l1"><a class="reference internal" href="quick_start/transplant.html">芯片通用移植指南</a></li>
<li class="toctree-l1"><a class="reference internal" href="quick_start/rtthread.html">基于 RT-Thread 软件包开发指南</a></li>
<li class="toctree-l1"><a class="reference internal" href="quick_start/esp.html">基于 ESP-Registry 开发指南</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">Q &amp; A</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#id1">移植提问模板</a></li>
<li class="toctree-l2"><a class="reference internal" href="#id2">其余问题提问模板</a></li>
<li class="toctree-l2"><a class="reference internal" href="#cherryusb">CherryUSB 性能能到多少</a></li>
<li class="toctree-l2"><a class="reference internal" href="#st-ip">ST IP 命名问题</a></li>
<li class="toctree-l2"><a class="reference internal" href="#gd-ip">GD IP 问题</a></li>
<li class="toctree-l2"><a class="reference internal" href="#dwc2-has-less-endpoints-than-config-please-check">dwc2 has less endpoints than config, please check</a></li>
<li class="toctree-l2"><a class="reference internal" href="#ep-addr-xxx-overflow">Ep addr XXX overflow</a></li>
<li class="toctree-l2"><a class="reference internal" href="#this-dwc2-version-does-not-support-dma-mode-so-stop-working">This dwc2 version does not support dma mode, so stop working</a></li>
<li class="toctree-l2"><a class="reference internal" href="#has-include">__has_include 报错</a></li>
<li class="toctree-l2"><a class="reference internal" href="#config-usb-hs">CONFIG_USB_HS 何时使用</a></li>
<li class="toctree-l2"><a class="reference internal" href="#failed-to-enable-port">Failed to enable port</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="opensource.html">官方开源项目分享</a></li>
<li class="toctree-l1"><a class="reference internal" href="share.html">开发者经验/开源项目分享</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">USB 基本知识点</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="usb/usb2.0_basic.html">USB 基本概念(2.0 为主)</a></li>
<li class="toctree-l1"><a class="reference internal" href="usb/usb3.0_basic.html">USB 基本概念(3.0 为主)</a></li>
<li class="toctree-l1"><a class="reference internal" href="usb/usb_desc.html">USB 描述符</a></li>
<li class="toctree-l1"><a class="reference internal" href="usb/usb_request.html">USB 设备请求</a></li>
<li class="toctree-l1"><a class="reference internal" href="usb/usb_enum.html">USB 枚举</a></li>
<li class="toctree-l1"><a class="reference internal" href="usb/usb_ext.html">USB 知识点拓展</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">API 手册</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="api/api_device.html">设备协议栈</a></li>
<li class="toctree-l1"><a class="reference internal" href="api/api_host.html">主机协议栈</a></li>
<li class="toctree-l1"><a class="reference internal" href="api/api_port.html">主从驱动</a></li>
<li class="toctree-l1"><a class="reference internal" href="api/api_config.html">USB CONFIG 说明</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">Class 指南</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="class/class_cdc.html">CDC</a></li>
<li class="toctree-l1"><a class="reference internal" href="class/class_hid.html">HID</a></li>
<li class="toctree-l1"><a class="reference internal" href="class/class_msc.html">MSC</a></li>
<li class="toctree-l1"><a class="reference internal" href="class/class_audio.html">UAC</a></li>
<li class="toctree-l1"><a class="reference internal" href="class/class_video.html">UVC</a></li>
<li class="toctree-l1"><a class="reference internal" href="class/winusb.html">WINUSB</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">例程说明</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="demo/usbd_cdc_acm.html">usbd_cdc_acm</a></li>
<li class="toctree-l1"><a class="reference internal" href="demo/usbd_hid.html">usbd_hid</a></li>
<li class="toctree-l1"><a class="reference internal" href="demo/usbd_msc.html">usbd_msc</a></li>
<li class="toctree-l1"><a class="reference internal" href="demo/usbd_rndis.html">usbd_rndis</a></li>
<li class="toctree-l1"><a class="reference internal" href="demo/usbd_ecm.html">usbd_cdc_ecm</a></li>
<li class="toctree-l1"><a class="reference internal" href="demo/usbd_audiov1.html">usbd_audiov1</a></li>
<li class="toctree-l1"><a class="reference internal" href="demo/usbd_audiov2.html">usbd_audiov2</a></li>
<li class="toctree-l1"><a class="reference internal" href="demo/usbd_video.html">usbd_video</a></li>
<li class="toctree-l1"><a class="reference internal" href="demo/usbd_winusb.html">usbd_winusb</a></li>
<li class="toctree-l1"><a class="reference internal" href="demo/usbd_webusb.html">usbd_webusb</a></li>
<li class="toctree-l1"><a class="reference internal" href="demo/usbh_serial.html">usbh_serial</a></li>
<li class="toctree-l1"><a class="reference internal" href="demo/usbh_hid.html">usbh_hid</a></li>
<li class="toctree-l1"><a class="reference internal" href="demo/usbh_msc.html">usbh_msc</a></li>
<li class="toctree-l1"><a class="reference internal" href="demo/usbh_net.html">usbh_net</a></li>
<li class="toctree-l1"><a class="reference internal" href="demo/usbh_bluetooth.html">usbh_bluetooth</a></li>
<li class="toctree-l1"><a class="reference internal" href="demo/usbh_wifi.html">usbh_wifi</a></li>
<li class="toctree-l1"><a class="reference internal" href="demo/usbd_vendor.html">vendor device 驱动编写</a></li>
<li class="toctree-l1"><a class="reference internal" href="demo/usbh_vendor.html">vendor host 驱动编写</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">USBIP 介绍</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="usbip/ohci.html">OHCI</a></li>
<li class="toctree-l1"><a class="reference internal" href="usbip/ehci.html">EHCI</a></li>
<li class="toctree-l1"><a class="reference internal" href="usbip/xhci.html">XHCI</a></li>
<li class="toctree-l1"><a class="reference internal" href="usbip/chipidea.html">CHIPIDEA</a></li>
<li class="toctree-l1"><a class="reference internal" href="usbip/dwc2.html">DWC2</a></li>
<li class="toctree-l1"><a class="reference internal" href="usbip/musb.html">MUSB</a></li>
<li class="toctree-l1"><a class="reference internal" href="usbip/fotg210.html">FOTG210</a></li>
<li class="toctree-l1"><a class="reference internal" href="usbip/cdns2.html">CDNS2</a></li>
<li class="toctree-l1"><a class="reference internal" href="usbip/cdns3.html">CDNS3</a></li>
<li class="toctree-l1"><a class="reference internal" href="usbip/dwc3.html">DWC3</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">工具使用</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="tools/index.html">chryusb_configurator</a></li>
<li class="toctree-l1"><a class="reference internal" href="tools/index.html#usb-protocol-suite">力科 USB Protocol Suite</a></li>
<li class="toctree-l1"><a class="reference internal" href="tools/index.html#wireshark">Wireshark</a></li>
<li class="toctree-l1"><a class="reference internal" href="tools/index.html#audacity">Audacity</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">版本说明</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="version.html">版本说明</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">商业支持</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="support/index.html">商业支持</a></li>
</ul>

        </div>
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="index.html">CherryUSB</a>
      </nav>

      <div class="wy-nav-content">
        <div class="rst-content">
          <div role="navigation" aria-label="Page navigation">
  <ul class="wy-breadcrumbs">
      <li><a href="index.html" class="icon icon-home" aria-label="Home"></a></li>
      <li class="breadcrumb-item active">Q &amp; A</li>
      <li class="wy-breadcrumbs-aside">
            <a href="_sources/q&amp;a.rst.txt" rel="nofollow"> View page source</a>
      </li>
  </ul>
  <hr/>
</div>
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
             
  <section id="q-a">
<h1>Q &amp; A<a class="headerlink" href="#q-a" title="Link to this heading"></a></h1>
<section id="id1">
<h2>移植提问模板<a class="headerlink" href="#id1" title="Link to this heading"></a></h2>
<p>请在下列途径提交问题：
- RT-Thread 官方论坛: <a class="reference external" href="https://club.rt-thread.org/ask/tag/5f5f851966917b14.html">https://club.rt-thread.org/ask/tag/5f5f851966917b14.html</a>
- Github issue: <a class="reference external" href="https://github.com/cherry-embedded/CherryUSB/issues/new/choose">https://github.com/cherry-embedded/CherryUSB/issues/new/choose</a></p>
<p>提问中请包含以下信息：</p>
<ul class="simple">
<li><p>使用的板子，引脚，USB IP</p></li>
<li><p>USB 中断，时钟，引脚，寄存器地址是否正确，截图</p></li>
<li><p>是否能进 USB 中断</p></li>
<li><p>芯片是否带有 cache功能，是否做了 no cache 处理，截图</p></li>
<li><p>硬件是否正常，是否使用杜邦线连接，如果正常，请说明正常原因</p></li>
<li><p>打开 CONFGI_USBDEV_SETUP_LOG_PRINT，并提供 log</p></li>
<li><p>是否流片并销售</p></li>
</ul>
</section>
<section id="id2">
<h2>其余问题提问模板<a class="headerlink" href="#id2" title="Link to this heading"></a></h2>
<p>具体说明现象，复现方式，使用我提供的 demo 再测试，以及提供完整 log</p>
</section>
<section id="cherryusb">
<h2>CherryUSB 性能能到多少<a class="headerlink" href="#cherryusb" title="Link to this heading"></a></h2>
<p>可以达到硬件极限性能，当然需要硬件理论支持到这速度，CherryUSB 就支持到这速度,举例如下：</p>
<ul class="simple">
<li><p>HPM 系列(从机可以到 42MB/S, 主机 44MB/S, 已经达到硬件极限)</p></li>
<li><p>BL 系列（从机 32MB/S, 主机 25MB/S, 已经达到硬件极限）</p></li>
<li><p>STM32F4 全速（从机 900KB/S, 主机 1.12MB/S, 已经达到硬件极限）</p></li>
</ul>
<p>从机测速demo: cdc_acm_template.c 并且关闭 log，脚本使用 <cite>tools/test_srcipts/test_cdc_speed.py</cite>
主机测速demo: usb_host.c 中 TEST_USBH_CDC_SPEED=1</p>
</section>
<section id="st-ip">
<h2>ST IP 命名问题<a class="headerlink" href="#st-ip" title="Link to this heading"></a></h2>
<p>ST 命名为 USB_OTG_FS, USB_OTG_HS，并不是说明本身是高速或者全速，只是代表可以支持到高速，但是本身都是全速，需要外挂高速phy。因此，提问禁止说这两个词，请使用 USB0(PA11/PA12),USB1(PB14/PB15) 代替。其余国产厂家同理。</p>
</section>
<section id="gd-ip">
<h2>GD IP 问题<a class="headerlink" href="#gd-ip" title="Link to this heading"></a></h2>
<p>GD IP 采用 DWC2，但是读取的硬件参数都是 0（我也不懂为什么不给人知道），因此需要用户自行知道硬件信息，以下列举 GD32F4 的信息：</p>
<p>CONFIG_USBDEV_EP_NUM pa11/pa12 引脚必须为 4，PB14/PB15 引脚必须为 6，并删除 usb_dc_dwc2.c 中 while(1){}</p>
<ul class="simple">
<li><p>当 CONFIG_USBDEV_EP_NUM 为4 时，fifo_num 不得大于 320 字</p></li>
<li><p>当 CONFIG_USBDEV_EP_NUM 为6 时，fifo_num 不得大于 1280 字</p></li>
</ul>
<p>其次 GD 复位以后无法使用 EPDIS 功能关闭端点，需要用户删除 reset 中断中的以下代码：</p>
<div class="highlight-C notranslate"><div class="highlight"><pre><span></span><span class="n">USB_OTG_INEP</span><span class="p">(</span><span class="n">i</span><span class="p">)</span><span class="o">-&gt;</span><span class="n">DIEPCTL</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">(</span><span class="n">USB_OTG_DIEPCTL_EPDIS</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">USB_OTG_DIEPCTL_SNAK</span><span class="p">);</span>
<span class="n">USB_OTG_OUTEP</span><span class="p">(</span><span class="n">i</span><span class="p">)</span><span class="o">-&gt;</span><span class="n">DOEPCTL</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">(</span><span class="n">USB_OTG_DOEPCTL_EPDIS</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">USB_OTG_DOEPCTL_SNAK</span><span class="p">);</span>
</pre></div>
</div>
</section>
<section id="dwc2-has-less-endpoints-than-config-please-check">
<h2>dwc2 has less endpoints than config, please check<a class="headerlink" href="#dwc2-has-less-endpoints-than-config-please-check" title="Link to this heading"></a></h2>
<p>该 IP 硬件上没有这么多端点，请修改 <cite>CONFIG_USBDEV_EP_NUM</cite></p>
</section>
<section id="ep-addr-xxx-overflow">
<h2>Ep addr XXX overflow<a class="headerlink" href="#ep-addr-xxx-overflow" title="Link to this heading"></a></h2>
<p>该 IP 硬件上没有这么多端点, 请更换 IP or 减少端点使用。并且默认 demo 不做双向功能，考虑到不是所有的 IP 都支持，因此默认是 81 02 这样的而不是 81 01，
如果支持，自行修改。某些 IP 双向端点可能会占用相同的硬件信息，不一定能同时使用，自行检查。</p>
</section>
<section id="this-dwc2-version-does-not-support-dma-mode-so-stop-working">
<h2>This dwc2 version does not support dma mode, so stop working<a class="headerlink" href="#this-dwc2-version-does-not-support-dma-mode-so-stop-working" title="Link to this heading"></a></h2>
<p>该 DWC2 版本不支持 dma 模式，禁止使用。</p>
</section>
<section id="has-include">
<h2>__has_include 报错<a class="headerlink" href="#has-include" title="Link to this heading"></a></h2>
<p>如果报错，需要编译器支持 c99 语法，如果是 keil，请用 ac6 编译器</p>
</section>
<section id="config-usb-hs">
<h2>CONFIG_USB_HS 何时使用<a class="headerlink" href="#config-usb-hs" title="Link to this heading"></a></h2>
<p>当你的芯片硬件支持高速，并想初始化成高速模式时开启，相关 IP 会根据该宏配置内部或者外部 高速 PHY。</p>
</section>
<section id="failed-to-enable-port">
<h2>Failed to enable port<a class="headerlink" href="#failed-to-enable-port" title="Link to this heading"></a></h2>
<p>供电不足或者硬件 USB 电路问题</p>
</section>
</section>


           </div>
          </div>
          <footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
        <a href="quick_start/esp.html" class="btn btn-neutral float-left" title="基于 ESP-Registry 开发指南" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
        <a href="opensource.html" class="btn btn-neutral float-right" title="官方开源项目分享" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
    </div>

  <hr/>

  <div role="contentinfo">
    <p>&#169; Copyright 2022 ~ 2024, sakumisu.</p>
  </div>

  Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
    <a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
    provided by <a href="https://readthedocs.org">Read the Docs</a>.
   

</footer>
        </div>
      </div>
    </section>
  </div>
  <script>
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script> 

</body>
</html>